<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>修改书籍</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/css/jquery-ui.css">
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/statics/js/jquery-ui.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<script type="text/javascript">
    function value(url) {
        document.getElementById("url").value=url;
    }
</script>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>修改书籍</small>
                </h1>
            </div>
        </div>
    </div>
    <form action="${pageContext.request.contextPath}/book/UpdateBook" enctype="multipart/form-data" method="post">
        <div class="form-group">
            <input type="hidden" name="bookID" value="${book.bookID}">
            <label>书籍封面:</label>
            <img src="${book.url}" width="100px" height="100px">
            <div class="dropdown">
                <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                    选择已有封面
                    <span class="caret"></span>
                </button>
                <input type="hidden" value="" name="url" id="url">
                <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                    <c:forEach var="image" items="${requestScope.get('imageUrl')}">
                        <li>
                            <a href="javascript:void(0);" onclick="value('${image}')"><img src="${image}" width="100px" height="100px"></a>
                        </li>
                        <li role="separator" class="divider"></li>
                    </c:forEach>
                </ul>
            </div>
            <label>选择本地图片:</label>
            <input type="file" class="form-control" name="file" autocomplete="off">
            <label>书籍名称:</label>
            <input type="text" class="form-control" name="bookName" value="${book.bookName}" required autocomplete="off">
            <label>书籍数量:</label>
            <input type="text" class="form-control" name="bookCounts" value="${book.bookCounts}" required autocomplete="off">
            <label>书籍详情:</label>
            <input type="text" class="form-control" name="detail" value="${book.detail}" required autocomplete="off">
            <br>
            <button type="submit" class="btn btn-default form-control">修改</button>
        </div>
    </form>

</div>